/**
 * 
 */
package common.quickvalid.validators;

import java.util.Map;


/**
 * 抽象的验证器实现, 仅实现了 setter和getter.
 * @author beansoft
 *
 */
public abstract class BaseValidator implements IValidator {
	private String[] args;

	
	private Map<String, String[]> params;
	private String expression;
	
	@SuppressWarnings("unchecked")
	public Map getParams() {
		return params;
	}
	
	@SuppressWarnings("unchecked")
	public void setParams(Map params) {
		this.params = params;
	}
	
	public String[] getArgs() { return args; }
	public void setArgs(String[] args) {this.args = args;}
	
	public String[] getValues(String name) {
		return params.get(name);
	}
	
	public String getValue(String name) {
		String[] values = getValues(name);
		
		if(values != null) {
			return values[0];
		}
		
		return null;
	}
	public String getExpression() {
		return expression;
	}
	public void setExpression(String expression) {
		this.expression = expression;
	}
	
}
